import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/layout'

Vue.use(Router)
export const constantRoutes = [
    {
        path: '/register',
        name: 'register',
        component: () => import("@/views/register"),
        meta: { title: "注册" },

    },
    // 登录
    {
        path: '/login',
        name: 'login',
        component: () => import("@/views/login"),
        meta: { title: "登录" },
        
    },
    // 忘记密码
    {
        path: '/forgotPassword',
        name: 'forgotPassword',
        component: () => import("@/views/forgotPassword"),
        meta: { title: "忘记密码" },
        
    },
    {
        
        path: '/notification',
        name: 'notification',
        component: () => import("@/components/notification"),
    },
    
    // 我的收藏
    {
        path: '/',
        component: Layout,
        redirect:'/siteMap',
        children: [
            {
                path: '/siteMap',
                name: 'siteMap',
                component: () => import("@/views/siteMap"),
                meta: { title: "站点地图" ,requireAuth:true},
                
            },
            {
                path: '/routeDetail',
                name: 'routeDetail',
                component: () => import("@/views/routeDetail"),
                meta: { title: "线路详情" },
                
            },
            

            {
                path: '/formPlan',
                name: 'formPlan',
                component: () => import("@/views/formPlan"),
                meta: { title: "行程规划" }
            },
            {
                path: '/myCollection',
                name: 'myCollection',
                component: () => import("@/views/myCollection"),
                meta: { title: "我的收藏" }
            },
            {
                path: '/history',
                name: 'history',
                component: () => import("@/views/history"),
                meta: { title: "历史线路" }
            }
            
        ],
    },
]


// localStorage.setItem("userId", data.userid);
export default new Router({
    
    routes: constantRoutes
})